package com.wl4837;

public class App
{
    public static void main( String[] args )
    {
        Originator originator = new  Originator();
        originator.setState("state1");
        System.out.println(originator.getState());
        Originator.Memento memento1 = originator.createMemento();
        originator.setState("state2");
        System.out.println(originator.getState());
        Originator.Memento memento2 = originator.createMemento();
        originator.restoreFromMemento(memento2);
        System.out.println(originator.getState());
        originator.restoreFromMemento(memento1);
        System.out.println(originator.getState());
    }
}
